package grg.learn.compose.ui.ui.main

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import grg.learn.compose.R
import grg.learn.compose.ui.components.MenuData
import grg.learn.compose.ui.components.Menus1

/**
 * create by iso88591 at 2021/8/21 🤔
 * 底部菜单
 */
@Composable
fun MainMenu(
    selectColor: Color,
    unSelectColor: Color,
    current: Int,
    selectChangeCall: ((position: Int, menuData: MenuData) -> Unit)? = null,
    modifier: Modifier = Modifier
) {

    Box(modifier) {
        Menus1(
            current,
            listOf(
                MenuData(
                    painterResource(id = R.drawable.ic_message_main_selected),
                    "微信",
                    selectColor
                ),
                MenuData(
                    painterResource(id = R.drawable.ic_friend_list_selected),
                    "通讯录",
                    selectColor
                ),
                MenuData(
                    painterResource(id = R.drawable.ic_find_selected),
                    "发现",
                    selectColor
                ),
                MenuData(
                    painterResource(id = R.drawable.ic_mine_selected),
                    "我的",
                    selectColor
                )
            ),
            listOf(
                MenuData(
                    painterResource(id = R.drawable.ic_message_main),
                    "微信",
                    unSelectColor
                ),
                MenuData(
                    painterResource(id = R.drawable.ic_friend_list),
                    "通讯录",
                    unSelectColor
                ),
                MenuData(
                    painterResource(id = R.drawable.ic_find),
                    "发现",
                    unSelectColor
                ),
                MenuData(
                    painterResource(id = R.drawable.ic_mine),
                    "我的",
                    unSelectColor
                )
            ),
            Modifier
                .height(40.dp)
                .padding(
                    top = 7.dp,
                    bottom = 5.dp
                ),
            Modifier
                .padding(bottom = 2.dp),
            fontSize = 12f.sp,
            selectChangeCall
        )
    }

}